package chika和蜜柑;

import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int k = in.nextInt();
        int[] s = new int[n];
        int[] t = new int[n];
        Integer[] index = new Integer[n];
        for (int i = 0; i < n; i++) {
            s[i] = in.nextInt();
            index[i] = i;
        }
        for (int i = 0; i < n; i++) {
            t[i] = in.nextInt();
        }
        Arrays.sort(index, (i, j) -> {
            if (t[i] == t[j]) {
                return s[i] - s[j];
            }
            return t[j] - t[i];
        });
        long res1 = 0, res2 = 0;
        for (int i = 0; i < k; i++) {
            res1 += s[index[i]];
            res2 += t[index[i]];
        }
        System.out.println(res1 + " " + res2);
    }
}
